<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title>此页面用于测试vue2中的filter</title>
		<script src="js/vue.js" type="text/javascript" charset="utf-8"></script>
	</head>

	<body>
		<!--说明：此代码成功。放弃了过滤器，使用methods中的format -->
		<div id="app">

			
			<table >
				
				<tr v-for="item in converSex">
					<td v-text="item.SName"></td>
					<td v-text="item.SSex"></td>
				</tr>
			</table>
		</div>

		<script type="text/javascript">
			window.onload = function() {
				//在这里面写Vue.js代码
				new Vue({
					el: '#app',
					computed: {
						converSex: function() {
							
							var len=this.message.length;
							for (var i = 0; i < len; i++) {
								var item=this.message[i];
								if(item.ISex==1){
									item.SSex="男";
								}else{
									item.SSex="女";
								}
							}
							
							return this.message;

							
							
						}
					},
					data: {
						message: [{
							"SName": "张三",
							"ISex": 1
						}, {
							"SName": "李四",
							"ISex": 2

						}]
					}
				})
				//----------------
			}
		</script>
	</body>

</html>